package com.tz.controller;

import com.tz.entity.ZhangWu;
import com.tz.service.ZhangWuService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet("/selestAllServlet")
public class SelectAllServlet extends HttpServlet {
    private ZhangWuService zhangWuService = new ZhangWuService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.调用ZhangWuService完成查询

        List<ZhangWu> zhangWus = zhangWuService.selectAll();


        //2.存入request域中
        request.setAttribute("zhangWus",zhangWus);

        //3.转发到brand.jsp
        request.getRequestDispatcher("/zhangwu.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request,response);
    }


}
